Occur when documents are created by a user. Also when a document is moved to a different folder or changed to a different document type.
Syntax
DocGenericEvent_*NewDocument(Batch, Action, SourceFile, DocType, DocTemplate)
Remarks
We recommend not setting any property values in the BeforeNewDocument event as this might cause the document to be created in a temporary parent folder before it is moved to its final destination, which might cause conflicts with existing documents.
The Before and After procedures are invoked when documents are imported with the Document Import Tool. The Initialize and Terminate procedures are not invoked by the Document Import Tool. The FailCurrent and Abort methods of the Batch object are also available; however, the BatchIndex property will always be 1.
When documents are imported using drag-and-drop, the source of the files cannot be determined by Meridian so the value of the Client.ClientID property is AS_CID_POWERUSER regardless of the source of the documents. For your script to know where the documents originated from in order to perform validation or other processing, the users must use the file commands that are provided by the Meridian application links.
Example
You can test the value of the $$ICIMP_PropInvalid batch argument to determine if property validation failed while running the Document Import Tool. If the validation failed, then you can prevent the import of the failed document using code similar to the following example.
Sub DocGenericEvent_BeforeNewDocument(Batch, Action, SourceFile, DocType, DocTemplate)
If CBool(Batch.Argument("$$ICIMP_PropInvalid")) = True Then Batch.FailCurrent("Property validation failed") End If End Sub
Tip Use the object argument Batch.Argument("__$$RelatedProjectCopy") to obtain the project copy that is being released as a master document. It can be useful to calculate the location for the master document location if it is being created for the first time.
Use the object argument Vault.Argument("__$$RelatedTransmittal") to relate a transmittal to a new submittal.
Use the object argument Vault.Argument("__$$SubmittalSender") to relate a person to a new submittal.
For more information, see Understanding object arguments.
Related concepts